@extends('layouts.app')

@section('title')
    后台-用户管理-用户新增
@stop

@section('extcss')
    <!--ext css-->
    <!-- Select2 -->
    <link href="{{asset("vendors/select2/dist/css/select2.min.css")}}" rel="stylesheet">
    <!-- Switchery -->
    <link href="{{asset("vendors/switchery/dist/switchery.min.css")}}" rel="stylesheet">
    <!-- /ext css-->
@stop

@section('content')
    <!-- page content -->
    <div class="right_col" role="main">
        <div class="">
            <div class="page-title">
                <div class="title_left">
                    <h3>新增用户</h3>
                </div>

                <div class="title_right">
                    &nbsp;
                </div>
            </div>
            <div class="clearfix"></div>

            <div class="row">
                <div class="col-md-12 col-sm-12 col-xs-12">
                    <div class="x_panel">
                        <div class="x_title">
                            <h2>新增用户</h2>
                            <ul class="nav navbar-right panel_toolbox">
                                <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                                </li>
                            </ul>
                            <div class="clearfix"></div>
                        </div>
                        <div class="x_content">
                            <form id="userForm" method="post" action="{{url('system/user')}}" class="form-horizontal form-label-left" >
                                {!! csrf_field() !!}
                                <div class="item form-group">
                                    <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">用户名 <span class="required">*</span>
                                    </label>
                                    <div class="col-md-6 col-sm-6 col-xs-12">
                                        <input type="text" id="name" name="name" class="form-control col-md-7 col-xs-12" placeholder="用户姓名" required="">
                                    </div>
                                </div>
                                <div class="item form-group">
                                    <label class="control-label col-md-3 col-sm-3 col-xs-12" for="email">用户账户 <span class="required">*</span>
                                    </label>
                                    <div class="col-md-6 col-sm-6 col-xs-12">
                                        <input type="email" id="email" name="email" class="form-control col-md-7 col-xs-12" placeholder="用户账户" required="">
                                    </div>
                                </div>
                                <div class="item form-group">
                                    <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">用户密码 <span class="required"> </span>
                                    </label>
                                    <div class="col-md-6 col-sm-6 col-xs-12">
                                        <input type="password" id="password" name="password" placeholder="用户密码" class="form-control col-md-7 col-xs-12">
                                    </div>
                                </div>
                                <div class="ln_solid"></div>
                                <div class="form-group">
                                    <div class="col-md-6 col-md-offset-3">
                                        <div class="col-md-6"><button type="submit" class="btn btn-success">提交</button></div>
                                        <div class="col-md-6"><button type="reset" class="btn btn-default">重置</button></div>
                                    </div>
                                </div>
                                <div class="ln_solid"></div>
                                <div class="row">
                                    @if($errors->any())
                                        <ul class="list-group">
                                            @foreach($errors->all() as $error)
                                                <li class="list-group-item list-group-item-danger">{{$error}}</li>
                                            @endforeach
                                        </ul>
                                    @endif
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- /page content -->
@stop

@section('extjs')
    <!--ext js-->
    <!-- Select2 -->
    <script src="{{asset("vendors/select2/dist/js/select2.full.min.js")}}"></script>
    <!-- Switchery -->
    <script src="{{asset("vendors/switchery/dist/switchery.min.js")}}"></script>
    <!-- Parsley -->
    <script src="{{asset("vendors/parsleyjs/dist/parsley.min.js")}}"></script>
    <script src="{{asset("vendors/parsleyjs/dist/i18n/zh_cn.js")}}"></script>


    <!--Parsley-->
    <script type="text/javascript">
        $(function () {
            $('#userForm').parsley().on('field:validated', function() {
                var ok = $('.parsley-error').length === 0;
                $('.bs-callout-info').toggleClass('hidden', !ok);
                $('.bs-callout-warning').toggleClass('hidden', ok);
            }).on('form:submit', function() {
                $(this).submit();
            });
        });
    </script>
    <!-- /Parsley-->
    <!-- /ext js-->
@stop